/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.hotel.test.model;

import com.hotel.test.service.HotelLocalServiceUtil;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.DateUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.util.PortalUtil;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.util.Date;

/**
 * @author Vien-IT
 */
public class HotelClp extends BaseModelImpl<Hotel> implements Hotel {
	public HotelClp() {
	}

	public Class<?> getModelClass() {
		return Hotel.class;
	}

	public String getModelClassName() {
		return Hotel.class.getName();
	}

	public long getPrimaryKey() {
		return _hotelId;
	}

	public void setPrimaryKey(long primaryKey) {
		setHotelId(primaryKey);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_hotelId);
	}

	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey(((Long)primaryKeyObj).longValue());
	}

	public long getHotelId() {
		return _hotelId;
	}

	public void setHotelId(long hotelId) {
		_hotelId = hotelId;
	}

	public long getUserId() {
		return _userId;
	}

	public void setUserId(long userId) {
		_userId = userId;
	}

	public String getUserUuid() throws SystemException {
		return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
	}

	public void setUserUuid(String userUuid) {
		_userUuid = userUuid;
	}

	public String getUserName() {
		return _userName;
	}

	public void setUserName(String userName) {
		_userName = userName;
	}

	public Date getCreateDate() {
		return _createDate;
	}

	public void setCreateDate(Date createDate) {
		_createDate = createDate;
	}

	public Date getModifiedDate() {
		return _modifiedDate;
	}

	public void setModifiedDate(Date modifiedDate) {
		_modifiedDate = modifiedDate;
	}

	public long getLocalId() {
		return _localId;
	}

	public void setLocalId(long localId) {
		_localId = localId;
	}

	public String getHotelName() {
		return _hotelName;
	}

	public void setHotelName(String hotelName) {
		_hotelName = hotelName;
	}

	public String getQuality() {
		return _quality;
	}

	public void setQuality(String quality) {
		_quality = quality;
	}

	public String getIntroduce() {
		return _introduce;
	}

	public void setIntroduce(String introduce) {
		_introduce = introduce;
	}

	public String getImage() {
		return _image;
	}

	public void setImage(String image) {
		_image = image;
	}

	public String getAddress() {
		return _address;
	}

	public void setAddress(String address) {
		_address = address;
	}

	public String getEmail() {
		return _email;
	}

	public void setEmail(String email) {
		_email = email;
	}

	public String getPhone() {
		return _phone;
	}

	public void setPhone(String phone) {
		_phone = phone;
	}

	public void persist() throws SystemException {
		if (this.isNew()) {
			HotelLocalServiceUtil.addHotel(this);
		}
		else {
			HotelLocalServiceUtil.updateHotel(this);
		}
	}

	@Override
	public Hotel toEscapedModel() {
		return (Hotel)Proxy.newProxyInstance(Hotel.class.getClassLoader(),
			new Class[] { Hotel.class }, new AutoEscapeBeanHandler(this));
	}

	@Override
	public Object clone() {
		HotelClp clone = new HotelClp();

		clone.setHotelId(getHotelId());
		clone.setUserId(getUserId());
		clone.setUserName(getUserName());
		clone.setCreateDate(getCreateDate());
		clone.setModifiedDate(getModifiedDate());
		clone.setLocalId(getLocalId());
		clone.setHotelName(getHotelName());
		clone.setQuality(getQuality());
		clone.setIntroduce(getIntroduce());
		clone.setImage(getImage());
		clone.setAddress(getAddress());
		clone.setEmail(getEmail());
		clone.setPhone(getPhone());

		return clone;
	}

	public int compareTo(Hotel hotel) {
		int value = 0;

		value = DateUtil.compareTo(getModifiedDate(), hotel.getModifiedDate());

		if (value != 0) {
			return value;
		}

		return 0;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		HotelClp hotel = null;

		try {
			hotel = (HotelClp)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long primaryKey = hotel.getPrimaryKey();

		if (getPrimaryKey() == primaryKey) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return (int)getPrimaryKey();
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(27);

		sb.append("{hotelId=");
		sb.append(getHotelId());
		sb.append(", userId=");
		sb.append(getUserId());
		sb.append(", userName=");
		sb.append(getUserName());
		sb.append(", createDate=");
		sb.append(getCreateDate());
		sb.append(", modifiedDate=");
		sb.append(getModifiedDate());
		sb.append(", localId=");
		sb.append(getLocalId());
		sb.append(", hotelName=");
		sb.append(getHotelName());
		sb.append(", quality=");
		sb.append(getQuality());
		sb.append(", introduce=");
		sb.append(getIntroduce());
		sb.append(", image=");
		sb.append(getImage());
		sb.append(", address=");
		sb.append(getAddress());
		sb.append(", email=");
		sb.append(getEmail());
		sb.append(", phone=");
		sb.append(getPhone());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(43);

		sb.append("<model><model-name>");
		sb.append("com.hotel.test.model.Hotel");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>hotelId</column-name><column-value><![CDATA[");
		sb.append(getHotelId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>userId</column-name><column-value><![CDATA[");
		sb.append(getUserId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>userName</column-name><column-value><![CDATA[");
		sb.append(getUserName());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>createDate</column-name><column-value><![CDATA[");
		sb.append(getCreateDate());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
		sb.append(getModifiedDate());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>localId</column-name><column-value><![CDATA[");
		sb.append(getLocalId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>hotelName</column-name><column-value><![CDATA[");
		sb.append(getHotelName());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>quality</column-name><column-value><![CDATA[");
		sb.append(getQuality());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>introduce</column-name><column-value><![CDATA[");
		sb.append(getIntroduce());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>image</column-name><column-value><![CDATA[");
		sb.append(getImage());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>address</column-name><column-value><![CDATA[");
		sb.append(getAddress());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>email</column-name><column-value><![CDATA[");
		sb.append(getEmail());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>phone</column-name><column-value><![CDATA[");
		sb.append(getPhone());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private long _hotelId;
	private long _userId;
	private String _userUuid;
	private String _userName;
	private Date _createDate;
	private Date _modifiedDate;
	private long _localId;
	private String _hotelName;
	private String _quality;
	private String _introduce;
	private String _image;
	private String _address;
	private String _email;
	private String _phone;
}